/**
 * Created by nico on 2015/12/27.
 */
var async = require('async');
//商品有关的模型
var log4js = require('log4js');
var logger = log4js.getLogger('normal');
var config = require('../config.js');
var activityM = require('../models/activity.js');

module.exports = {
    init : function(req, res, next){
        res.render('activity/luckdraw',{title:'幸运大转盘'});
    },
    startTurntableActivity:function(req, res){
        var uid = req.AV.user.id;
        //var level = req.params.Level;
        //var activityName = req.params.ActivityName;
        var level = req.query.Level;
        var activityName = req.query.ActivityName;
        activityM.turntableActivity(uid,level,activityName).then(function(data){
            res.json(data);
        }).catch(function(err){
            //出错或者不能抽奖
            res.json(err);
        });
    }

}